package com.labichaoka.chaoka.ui.home.fragment.my.message;

import com.labichaoka.chaoka.entity.MessageListResponse;

/**
 * Created by ruan on 2018/8/14.
 */

public class MessagePresenterImpl implements MessagePresenter,MessageInteractor.OnGetMessageFinishedListener {
    private MessageInteractor interactor;
    private MessageView view;

    public MessagePresenterImpl(MessageInteractor interactor, MessageView view) {
        this.interactor = interactor;
        this.view = view;
    }

    @Override
    public void getMessageList() {
        if (view!=null){
            view.showProgress();
        }
        interactor.getMessageList(this);

    }

    @Override
    public void onDestroy() {
        view=null;
    }

    @Override
    public void onSuccess(MessageListResponse response) {
        view.hideProgress();
        view.setData(response);
    }

    @Override
    public void onFailed() {
        view.hideProgress();
    }
}
